from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from config import DevelopmentConfig, ProductionConfig
from info import create_app, db, models

# manager.py 管理程序的启动，已发布模式还是调用模式，此类管理即可
app = create_app(DevelopmentConfig)
# 创建Manager ,拥有命令行
manager = Manager(app)
# # 创建Ｍigrate对象
Migrate(app, db)
# # 给Manager绑定迁移命令 --> 命令行增加了db命令　以及迁移指令
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    print(app.url_map)
    manager.run()